package cn.hchaojie.daily.dao.impl;

import java.util.Date;

import org.junit.Test;

import cn.hchaojie.daily.dao.DailyDao;
import cn.hchaojie.daily.entity.Daily;

public class TestDailyDao {
	public static void main(String[] args) {
		DailyDao dao = new DailyDaoImpl();
		
		Daily d = new Daily();
		d.setCreated(new Date());
		d.setDigest("这个摘要");
		d.setUid(4L);
		d.setViews(999);
		d.setContent("这是内容");
		
		dao.insert(d);
	}
	
	@Test
	public void testInsert() {
		DailyDao dao = new DailyDaoImpl();
		for (int i = 0; i < 60; i++) {
			Daily d = new Daily();
			d.setCreated(new Date());
			d.setDigest("这个摘要" + i);
			d.setUid(1L);
			d.setViews(i);
			d.setContent("这是内容" + i);
			
			dao.insert(d);
		}
	}
	
	@Test
	public void testPage() {
		DailyDao dao = new DailyDaoImpl();
		dao.getDailies(1, 8).forEach(daily -> {
			System.out.println(daily);
		});
	}
}
